<?php

if (!defined('IN_XLP')) {
    exit('Access Denied!');
}
/**
 * Description of parity
 * 数据抓取
 * @author hsisme
 */

class parity {
    public static $errInfo  = null;
    public static $base_url = "http://192.168.2.102:3000/api/";


    //实时比价
    static public function sendData($objData) {
        if(!$objData){
            showError('抱歉，参数不全无法访问！');
        }    
        // z($objData);
        $rs = getHttp(self::$base_url.'seeking/gold' , json_encode($objData));
        $rs = json_decode($rs , true);
        // z($rs);
        if($rs['code'] == 'success') {
            return $rs['data'];
        }else{
            self::$errInfo = $rs['error'];
            return false;
        }
    }



    // 历史行情 
    static public function sendRecordsData($objData) {
        if(!$objData){
            showError('抱歉，参数不全无法访问！');
        } 
        $rs = getHttp(self::$base_url.'DNFHistories/trended' , json_encode($objData));
        $rs = json_decode($rs , true);
        // z(json_encode($objData));
        if($rs['code'] == 'success') {
            return $rs['data'];
        }else{
            self::$errInfo = $rs['error'];
            return false;
        }
    }


    static public function gerError() {
        return self::$errInfo;
    }

}
